home *** CD-ROM | disk | FTP | other *** search
/ Amiga Plus 2004 #2 / Amiga Plus CD - 2004 - No. 02.iso / AmigaPlus / Tools / Development / AmigaTalk / system / PrinterFlags.st < prev    next >
Encoding:
Text File  |  2004-01-31  |  1.6 KB  |  60 lines

  1. " ------------------------------------------------------------------- "
  2. " PrinterFlags Class is a Singleton class that allows the user to     "
  3. " reference special printer flags & commands  values symbolically.    "
  4. ""
  5. "   EXAMPLE:  'myFlag <- printerFlags systemTag: #PPRA_Window'        "
  6. ""
  7. " ALL singleton classes MUST contain the following:                   "
  8. ""
  9. "   the methods:  isSingleton AND privateSetup     AND                "
  10. "                 uniqueInstance Class instance variable.             "
  11. " ------------------------------------------------------------------- "
  12.  
  13. Class PrinterFlags :Object ! uniqueInstance private0 private1 myName !
  14. [
  15.    isSingleton
  16.  
  17.      ^ true
  18. |
  19.    privateNew ! newInstance !
  20.    
  21.     newInstance <- <primitive 110 1>. " Object does NOT respond to new. "
  22.     
  23.     ^ newInstance  
  24. |
  25.    new
  26.  
  27.      ^ (self privateSetup)
  28. |
  29.    privateSetup
  30.  
  31.      (uniqueInstance isNil)
  32.        ifTrue: [ uniqueInstance <- self privateNew.
  33.                  
  34.                  myName         <- 'AmigaTalk:prelude/listFiles/Printer.dictionary'.
  35.        
  36.                  private0       <- <primitive 206 3>.
  37.                  
  38.                  private1       <- <primitive 206 1 myName private0>. ].
  39.                
  40.      ^ self
  41. |
  42.    close     " Remove, Kill, Destroy, Burn the Bridge, etc! "
  43.  
  44.      private1   <- <primitive 206 0 private1 private0>.
  45.  
  46.      ^ private0 <- nil.
  47. |
  48.    systemTag: aSymbol
  49.  
  50.      " Search for aSymbol in the SystemDictionary & return it's
  51.      * associated value:
  52.      " 
  53.      ^ <primitive 206 2 private0 aSymbol>
  54.    printString
  55.  
  56.      ^ 'PrinterFlags'
  57. ]
  58.  
  59.